<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="../../js/new-ajax.js"></script>
<script type="text/javascript" src="../../js/business-poweritem.js"></script>
<title></title>
<style type="text/css">
body{
	background: #ccc;
	margin: 0px;
	font-size: 12px;
}
div.menu-container{
	padding: 5px 3px;
	background: #fff;
	margin: 3px;
}
div.menu-header{
	padding: 8px 0px;
	text-align: center;
	background: #FA6703;
	color: #fff;
	font-weight: bold;
	cursor: default;
}
#menuContainer{
	cursor: default; 
}
#menuContainer div{
	padding: 2px 0px;
}
</style>
<script type="text/javascript">
function loadPage(url){
	window.parent.document.getElementById("mainFrame").src="./pages/"+url;
}

function createMenuPanel(){
	createMenu(0);
}
function createMenu(pid,step){
	for(var i=0;i<menuItems.length;i++){
		if(menuItems[i].pid==pid){
			createMenuItem(menuItems[i],step?step:0);
			createMenu(menuItems[i].id,(step?step:0)+1);
		}
	}
}
function createMenuItem(menuItem,step){
	var menuContainer=dqbb.$("menuContainer");
	var div=document.createElement("div");
	if(menuItem.url.trim().length<1){//没有地址
		div.innerHTML="<b>"+stepToSpace(step)+menuItem.text+"</b>";
	}
	else{
		div.innerHTML=stepToSpace(step)+menuItem.text;
		div.url=menuItem.url;
		div.onclick=function(){
			if(window.currentMenu){
				window.currentMenu.style.backgroundColor="";
			}
			window.currentMenu=this;
			this.style.backgroundColor="#ccc";
			loadPage(this.url);
		};
		div.onmouseover=function(){
			this.style.backgroundColor="#ccc";
		};
		div.onmouseout=function(){
			if(this!=window.currentMenu){
				this.style.backgroundColor="";
			}
		};
	}
	menuContainer.appendChild(div);
}
function stepToSpace(step){
	var buffer="";
	for(var i=0;i<step;i++){
		buffer+="&nbsp;&nbsp;&nbsp;&nbsp;";
	}
	return buffer;
}
window.onload=function(){
	createMenuPanel();
};
</script>
</head>
<body>
<div class="menu-container">
	<div class="menu-header">系统菜单</div>
	<div id="menuContainer">
		
	</div>
</div>
</body>
</html>